package cn.volunteer.points.system.controller;

import cn.volunteer.points.system.api.REST_URL;
import cn.volunteer.points.system.service.FileService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @description: 文件上传后端接口
 * @author:
 * @create: 创建时间：2021-04-15
 **/
@RestController
@Slf4j
public class FileController extends RestfulController{


    @Autowired
    private FileService fileService ;

    @ApiOperation("文件上传")
    @PostMapping(path = REST_URL.UPLOAD_FILE)
    public Response<?> loadFile(@RequestParam("file") MultipartFile file ){
        String result = fileService.uploadFile(file);
        return success(result,"文件已上传！！！");
    }
}
